package com.ruoyi.web.controller.app;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.HgtpieDo;
import com.ruoyi.system.domain.StNews;
import com.ruoyi.system.service.IStNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;

/**
 * 公告信息Controller
 * 
 * @author ruoyi
 * @date 2024-02-05
 */
@RestController
@RequestMapping("/stapp/news")
public class StnewsAppController extends BaseController
{
    @Autowired
    private IStNewsService stNewsService;
    //获取食堂简介
    @PostMapping("newslist")
    HashMap<Object, Object> newslist() {
        HashMap<Object, Object> map = new HashMap<>();
        HashMap<Object, Object> aa = new HashMap<>();
        aa.put("code",0);
        StNews stNews=new StNews();
        stNews.setType("1");
        List<StNews> StNewslist = stNewsService.selectStNewsList(stNews);
        aa.put("requestdata",StNewslist);
        aa.put("msg","提交成功");
        map.put("data",aa);
        return map;
    }
    @PostMapping("noticelist")
    HashMap<Object, Object> noticelist() {
        HashMap<Object, Object> map = new HashMap<>();
        HashMap<Object, Object> aa = new HashMap<>();
        aa.put("code",0);
        StNews stNews=new StNews();
        stNews.setTitle("通知公告");
        List<StNews> StNewslist = stNewsService.selectStNewsList(stNews);
        aa.put("requestdata",StNewslist);
        aa.put("msg","提交成功");
        map.put("data",aa);
        return map;
    }
    @PostMapping("slideslist")
    HashMap<Object, Object> slideslist() {
        HashMap<Object, Object> map = new HashMap<>();
        HashMap<Object, Object> aa = new HashMap<>();
        aa.put("code",0);
        StNews stNews=new StNews();
        stNews.setTitle("轮播图片");
        List<StNews> StNewslist = stNewsService.selectStNewsList(stNews);
        aa.put("requestdata",StNewslist);
        aa.put("msg","提交成功");
        map.put("data",aa);
        return map;
    }

}
